/**
*@class MouseCC
*@brief Mouse Control Center
*@author De Schutter Bob
*@date 04-2011
*
* @section source Sources
* mouse.cpp
* mouse.h
*
* @section working Parses the input from the mice
*
* @section destination Destination
*
*/
#ifndef MOUSECC_H
#define MOUSECC_H

#include <iostream>
#include <cmath>
#include "thread.h"
#include "mousecc.h"
#include "mouse.h"
#include "log.h"

#define DPI 1
#define DIST 2016
//#define CORRECT 0.9474f
#define TRESH 100

using namespace std;

class MouseCC : public Thread
{
public:
    ///Constructor
    MouseCC();
    ///Destructor
    ~MouseCC();
    ///Called when thread is started.
    void run();
    //feedback function
    void setupFeedback(float deriv, void(*pt2fb)(float) );
    //stop giving feedback
    void stopFeedback();
private:
    //pointer to logfile
    Log *l;
    //represent the two mice
    Mouse m0,m1;
    //x and y coordinates from mouse 0
    int m0_dx,m0_dy;
    //x and y coordinates from mouse 1
    int m1_dx,m1_dy;
    //global X and Y positions and angle of both mice with the soccer field
    double X,Y,angle_;
    //calculates the angle and positions
    void calculate();

	bool feedback_;
	float devi_;
	float angleDifference_;
	void(*pt2fb_)(float);
};
#endif
